package example;

/**
 * Created by IntelliJ IDEA.
 * User: stermi
 * Date: 29-nov-2009
 * Time: 12.36.05
 * To change this template use File | Settings | File Templates.
 */


import java.sql.*;
import java.util.Properties;


public class DBConnection {

    private String url;
    private Properties props;

    public DBConnection( ) {
        try {
            Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        this.url = "jdbc:postgresql://localhost/isi";
        this.props = new Properties();
        this.props.setProperty("user","postgres");
        this.props.setProperty("password","root");




    }
    

    public Connection getConnection() {

        Connection conn = null;

        try {
            conn = DriverManager.getConnection(this.url, this.props);
            conn.setAutoCommit(false);
        } catch (SQLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        return conn;
    }

    
}
